package com.ruoyi.bizsys.service.impl;

import java.util.List;
import java.util.Arrays;
                                                                                                                                                                                                        import com.ruoyi.common.utils.DateUtils;
            import org.springframework.stereotype.Service;
    import com.ruoyi.bizsys.mapper.RuleNodeResultMapper;
import com.ruoyi.bizsys.domain.RuleNodeResult;
import com.ruoyi.bizsys.service.IRuleNodeResultService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


/**
 * 节点结果记录Service业务层处理
 *
 * @author african-loan
 * @date 2021-10-28
 */
@Service
public class RuleNodeResultServiceImpl extends ServiceImpl<RuleNodeResultMapper,RuleNodeResult> implements IRuleNodeResultService {

    /**
     * 查询节点结果记录
     *
     * @param id 节点结果记录ID
     * @return 节点结果记录
     */
    @Override
    public RuleNodeResult selectRuleNodeResultById(Long id) {
        return this.getById(id);
    }

    /**
     * 查询节点结果记录列表
     *
     * @param ruleNodeResult 节点结果记录
     * @return 节点结果记录
     */
    @Override
    public List<RuleNodeResult> selectRuleNodeResultList(RuleNodeResult ruleNodeResult) {
        return this.list(new QueryWrapper<>(ruleNodeResult).last("order by id desc"));
    }

    /**
     * 新增节点结果记录
     *
     * @param ruleNodeResult 节点结果记录
     * @return 结果
     */
            @Override
    public int insertRuleNodeResult(RuleNodeResult ruleNodeResult) {
                                                                                                                                                                                                                                                                                                                                                ruleNodeResult.setCreateTime(DateUtils.getNowDate());
                                                return baseMapper.insert(ruleNodeResult);
    }

    /**
     * 修改节点结果记录
     *
     * @param ruleNodeResult 节点结果记录
     * @return 结果
     */
            @Override
    public int updateRuleNodeResult(RuleNodeResult ruleNodeResult) {
                                                                                                                                                                                                                                                                                                                                                                    ruleNodeResult.setUpdateTime(DateUtils.getNowDate());
                            return baseMapper.updateById(ruleNodeResult);
    }

    /**
     * 批量删除节点结果记录
     *
     * @param ids 需要删除的节点结果记录ID
     * @return 结果
     */
            @Override
    public int deleteRuleNodeResultByIds(Long[] ids) {
        return baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除节点结果记录信息
     *
     * @param id 节点结果记录ID
     * @return 结果
     */
    @Override
    public int deleteRuleNodeResultById(Long id) {
        return baseMapper.deleteById(id);
    }

}
